<template>
  <div>
    <el-cascader :options="options" placeholder="请输入地区" />
    <hr>
    <el-cascader :options="options1" placeholder="请输入地区" />
  </div>
</template>
<script>
// import { getlist } from "./api/home";
import axios from "axios";

export default {
  data() {
    return {
      options: [],
      options1: [],
    };
  },
  methods: {
    getlistinfo() {
      axios
        .get("https://api.tf2sc.cn/api/tfcar/city/treeList", {
          headers: { PlatformType: "h5" },
        })
        .then((v) => {
          let res = v.data.data.map((v) => {
            v.label = v.name;
            v.value = v.name;
            v.children.forEach((v) => {
              // console.log(v, "----------------");
              v.label = v.name;
              v.value = v.name;
            });
            return v;
          });
          this.options.push(...res);
        });
        axios('http://api.jqrjq.cn/api/region/pid?pid=0').then(v=>{
          let res=v.data.data.regions
          res.forEach(v=>{
            v.label=v.name;
            v.value=v.name;
          })
        console.log(res);
        this.options1.push(...res)

        })
    },
  },
  created() {
    this.getlistinfo();
  },
};
</script>

<style scoped></style>
